
use reqwest::Result;
use music::Api::music_api::MusicApi;

fn main() -> Result<()> {


    let api = MusicApi{};
    let account = api.login("17602830724", "_email2158");

    let search_songs = api.search_son("海阔天空").unwrap();

    println!("search songs len={}", search_songs.len());

    search_songs.iter().for_each(|x| {
        println!("id={}, name={}, duration={}, can play={}, the url = {}!",
                 x.id, x.name, x.duration,
                 x.can_play(),
                 x.get_url().unwrap_or(format!("can't get the url of the song id ={}", x.id)));
    });

    //let song = api.get_song_url(33894312);

    Ok(())
}